Soru & Cevap

Android Studio Kullanıcıdan Link Alma

11.05.2020 - 10:59

Merhaba dostlar. Android studio da jsoup kullanarak html parsing yapabiliyorum. Fakat şöyle bir sorunum var. String URL ="www.aaa.com" gibi örnek sitelerden parsing yapabiliyorum ama bu işlemi kendim site linki yazmak yerine kullanıcıdan site linkini nasıl aldırıp parse edebilirim?

10 Görüntülenme

7 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user .tire.
.tire.
12.05.2020 - 03:30
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:30
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:30
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:29
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:29
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:29
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Profile picture for user .tire.
.tire.
12.05.2020 - 03:29
import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = findViewById(R.id.text_view); String text = "I want THIS and THIS to be clickable"; SpannableString ss = new SpannableString(text); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "One", Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLUE); ds.setUnderlineText(false); } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View widget) { Toast.makeText(MainActivity.this, "Two", Toast.LENGTH_SHORT).show(); } }; ss.setSpan(clickableSpan1, 7, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 16, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }